﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="DistributedList.ascx.cs"
    Inherits="Framework.Portal.Layouts.Admin.Components.Teenio.Workflow.DistributedList" %>
<%@ Register Assembly="System.Web.Extensions" Namespace="System.Web.UI" TagPrefix="asp" %>
<table align="center" width="100%" cellspacing="1" cellpadding="0" border="0" class="content">
    <tr>
        <td class="header1" colspan="4" align="left">
            <asp:Label ID="lblCommandName" runat="server"></asp:Label>
        </td>
    </tr>
    <tr>
        <td colspan="4" class="header2" height="21">
            &nbsp;
        </td>
    </tr>
    <tr>
        <td class="postheader">
            <strong>Từ khóa</strong>
        </td>
        <td class="post">
            <asp:TextBox ID="txtkeysearch" runat="server" Width="100%"></asp:TextBox>
        </td>
        <td class="postheader" width="15%" align="left">
            <strong>Trạng thái</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:DropDownList ID="drpContentStatus" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="postheader" width="15%" align="left">
            <strong>Chuyên mục</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:DropDownList ID="dropZones" runat="server" Width="190px">
            </asp:DropDownList>
        </td>
        <td class="postheader" width="15%" align="left">
            <strong>Dạng bài</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:DropDownList ID="drpContentKind" runat="server">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="postheader" width="15%" align="left">
            <strong>Từ ngày</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:TextBox ID="txtFromDate" CssClass="inputDate" runat="server" Width="200px"></asp:TextBox>
        </td>
        <td class="postheader" width="15%" align="left">
            <strong>Loại bài</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:DropDownList ID="drpContentRank" runat="server" DataValueField="key" DataTextField="value">
            </asp:DropDownList>
        </td>
    </tr>
    <tr>
        <td class="postheader" width="15%" align="left">
            <strong>Đến ngày</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:TextBox ID="txtToDate" CssClass="inputDate" runat="server" Width="200px"></asp:TextBox>
        </td>
        <td class="postheader" width="15%" align="left">
            <strong>Kiểu bài</strong>
        </td>
        <td class="post" width="35%" align="left">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" RenderMode="Inline">
                <ContentTemplate>
                    <asp:DropDownList ID="drpContentType" runat="server" AutoPostBack="true" OnSelectedIndexChanged="drpContentType_SelectedIndexChanged"
                        DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                    &nbsp;
                    <asp:DropDownList ID="drpContentPerpective" runat="server" DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                </ContentTemplate>
            </asp:UpdatePanel>
        </td>
    </tr>
    <tr>
        <td class="postfooter" colspan="4" valign="middle" align="center">
            <asp:Button ID="btnSearch" runat="server" Text="Tìm kiếm" CssClass="pbutton" OnClick="btnSearch_Click" />
        </td>
    </tr>
</table>
<br />
<table width="100%" cellspacing="1" cellpadding="0" border="0" class="content">
    <tr>
        <td class="header2" align="center" width="3%">
            #
        </td>
        <td class="header2" align="left" width="35%">
            <NS:Label ID="Label1" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="NAME" />
        </td>
        <td class="header2" align="left" width="16%">
            <NS:Label ID="Label7" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="CATEGORY" />
        </td>
        <td class="header2" align="left" width="14%">
            <NS:Label ID="Label2" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="ALIAS" />
        </td>
        <td class="header2" align="left" width="7%">
            <NS:Label ID="Label3" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="RANK" />
        </td>
        <td class="header2" align="left" width="5%">
            <NS:Label ID="Label5" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="VIEW" />
        </td>
        <td class="header2" align="left" width="5%">
            <NS:Label ID="Label4" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="HIT" />
        </td>
        <td class="header2" align="left" width="7%">
            <NS:Label ID="Label6" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="STATUS" />
        </td>
        <td class="header2" align="left" width="8%">
            <NS:Label ID="Label8" runat="server" LocalizedPage="TABLECAPTION" LocalizedTag="ACTION" />
        </td>
    </tr>
    <asp:Repeater ID="rptDistributed" runat="server" OnItemCommand="rptDistributed_ItemCommand"
        OnItemDataBound="rptDistributed_ItemDataBound">
        <ItemTemplate>
            <tr>
                <td class="post" align="center">
                    <asp:CheckBox ID="chkCheckThis" runat="server" /><asp:HiddenField ID="lblKey" runat="server" />
                </td>
                <td class="post" align="left">
                    <asp:HyperLink ID="hplContent" runat="server"></asp:HyperLink>
                </td>
                <td class="post" align="left">
                    <span id="lbl_categories_<%# Eval("CONTENT_ID") %>"></span>
                </td>
                <td class="post" align="left">
                    <span id="lbl_authors_<%# Eval("CONTENT_ID") %>"></span>
                </td>
                <td class="post" align="left">
                    <asp:DropDownList ID="drpRPTRANK" runat="server" DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                </td>
                <td class="post" align="left">
                    <%# Eval("CONTENT_VIEW")%>
                </td>
                <td class="post" align="left">
                    <%# Eval("CONTENT_HIT")%>
                </td>
                <td class="post" align="left">
                    <asp:DropDownList ID="drpRPTSTATUS" runat="server" DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                </td>
                <td class="post" align="left">
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="EDIT24" ID="btnImgManageProfile"
                        runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="edit"
                        ToolTip="Sửa" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="UNPUBLISH24" ID="btnImgManagePassword" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="unpublish" ToolTip="Gỡ xuống" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="PUBLISH24" ID="ImageButton1" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="publish" ToolTip="Đăng lên" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="DELETE24" ID="ImageButton2" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="remove" ToolTip="Xóa" />
                </td>
            </tr>
        </ItemTemplate>
        <AlternatingItemTemplate>
            <tr>
                <td class="postheader" align="center">
                    <asp:CheckBox ID="chkCheckThis" runat="server" /><asp:HiddenField ID="lblKey" runat="server" />
                </td>
                <td class="postheader" align="left">
                    <asp:HyperLink ID="hplContent" runat="server"></asp:HyperLink>
                </td>
                <td class="postheader" align="left">
                    <span id="lbl_categories_<%# Eval("CONTENT_ID") %>"></span>
                </td>
                <td class="postheader" align="left">
                    <span id="lbl_authors_<%# Eval("CONTENT_ID") %>"></span>
                </td>
                <td class="postheader" align="left">
                    <asp:DropDownList ID="drpRPTRANK" runat="server" DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                </td>
                <td class="postheader" align="left">
                    <%# Eval("CONTENT_VIEW")%>
                </td>
                <td class="post" align="left">
                    <%# Eval("CONTENT_HIT")%>
                </td>
                <td class="postheader" align="left">
                    <asp:DropDownList ID="drpRPTSTATUS" runat="server" DataValueField="key" DataTextField="value">
                    </asp:DropDownList>
                </td>
                <td class="postheader" align="left">
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="EDIT24" ID="btnImgManageProfile"
                        runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="edit"
                        ToolTip="Sửa" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="UNPUBLISH24" ID="btnImgManagePassword" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="unpublish" ToolTip="Gỡ xuống" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="PUBLISH24" ID="ImageButton1" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="publish" ToolTip="Đăng lên" />
                    <NS:ImageButton LocalizedPage="IMAGEACTION" LocalizedTag="DELETE24" ID="ImageButton2" runat="server" CommandArgument='<%# Eval("CONTENT_ID") %>' CommandName="remove" ToolTip="Xóa" />
                </td>
            </tr>
        </AlternatingItemTemplate>
    </asp:Repeater>
    <tr>
        <td class="postfooter" colspan="9" valign="middle" align="left" height="25">
            <asp:Button ID="Button1" runat="server" Text="Cập nhật" CssClass="pbutton" OnClick="btnUpdate_Click" />
            &nbsp;
            <asp:Button ID="Button2" runat="server" Text="Xóa" CssClass="pbutton" OnClick="btnUpdate_Click" />
            &nbsp;
            <asp:Label ID="lblUpdateStatus" runat="server" Font-Bold="True" ForeColor="Blue"></asp:Label>
            </td>
    </tr>
</table>
<script type="text/javascript">
    $('#<%= txtFromDate.ClientID %>').DatePicker({
        format: 'd/m/Y',
        date: $('#<%= txtFromDate.ClientID %>').val(),
        current: $('#<%= txtFromDate.ClientID %>').val(),
        starts: 1,
        position: 'right',
        onBeforeShow: function () {
            $('#<%= txtFromDate.ClientID %>').DatePickerSetDate($('#<%= txtFromDate.ClientID %>').val(), true);
        },
        onChange: function (formated, dates) {
            $('#<%= txtFromDate.ClientID %>').val(formated);
            //$('#inputDate').DatePickerHide();
        }
    });
    $('#<%= txtToDate.ClientID %>').DatePicker({
        format: 'd/m/Y',
        date: $('#<%= txtToDate.ClientID %>').val(),
        current: $('#<%= txtToDate.ClientID %>').val(),
        starts: 1,
        position: 'right',
        onBeforeShow: function () {
            $('#<%= txtToDate.ClientID %>').DatePickerSetDate($('#<%= txtToDate.ClientID %>').val(), true);
        },
        onChange: function (formated, dates) {
            $('#<%= txtToDate.ClientID %>').val(formated);
            //$('#inputDate').DatePickerHide();
        }
    });		
    var arrayArticle = <%= arrayArticle %>;
    $(document).ready(function () {        
         $.each(arrayArticle, function(index, value) {             
                $("#lbl_categories_" + value.ID).html(value.CATEGORY);
                $("#lbl_authors_" + value.ID).html(value.AUTHOR);
        });        
    });
</script>
